package db

import (
	"fmt"
	"github.com/jinzhu/gorm"
	_ "github.com/jinzhu/gorm/dialects/mysql"
)

var MasterDb *gorm.DB

func init()  {
	var err error
	host := "localhost"
	user := "root"
	dbName := "shopping"
	password := "123456"
	MasterDb, err = gorm.Open("mysql", fmt.Sprintf(
		"%s:%s@tcp(%s:3306)/%s?charset=utf8&parseTime=True&loc=Local",
		user, password, host, dbName,
	),)
	if err != nil {
		panic(err)
	}
}
